package au.com.handsunited.web.controller.user;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractController;

import au.com.handsunited.web.session.SessionSupport;

/**
 * @author arunda
 * Date: 19/02/2007
 * Time: 08:21:40
 */
public class LogoffController extends AbstractController{


	private String successView;

	private static Logger logger = LoggerFactory.getLogger(LogoffController.class);

	/**
	 * @see org.springframework.web.servlet.mvc.AbstractController#handleRequestInternal(javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse)
	 */
	@Override
	protected ModelAndView handleRequestInternal(HttpServletRequest request,
			HttpServletResponse response) throws Exception {

		SessionSupport.setLoggedInUser(request, null);
		request.getSession().invalidate();

//		ModelAndView mav = new ModelAndView("user/login");
//		mav.addObject("userCredentials", new UserLoginCommand());
		ModelAndView mav = new ModelAndView(successView);
		return mav;
	}

	/**
	 *
	 * @param successView
	 */
	public void setSuccessView(String successView) {
		this.successView = successView;
	}



}
